home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Demos / showvars.stk < prev    next >
Encoding:
Text File  |  1996-02-22  |  1.4 KB  |  55 lines

  1. #!/bin/sh
  2. :;exec /usr/local/bin/stk -l "$0" "$@"
  3. ;;
  4. ;; show-vars w var var var ...
  5. ;;
  6. ;; Create a top-level window that displays a bunch of global variable values
  7. ;; and keeps the display up-to-date even when the variables change value
  8. ;;
  9. ;; Arguments:
  10. ;;    w -        Name to use for new top-level window.
  11. ;;    var -      Name of variable to monitor.
  12. ;;
  13. ;;
  14. ;; Note that this demo is run with the -l option (instead of the classical -f)
  15. ;;
  16. ;;
  17. ;;           Author: Erick Gallesio [eg@unice.fr]
  18. ;;    Creation date:  9-Aug-1993 22:06
  19. ;; Last file update: 17-Jan-1996 16:54
  20.  
  21. (define (show-vars w . args)
  22.   (catch (destroy w))
  23.   (toplevel w)
  24.   (wm 'title w "Variable values")
  25.   (label (& w ".title")
  26.      :text "Variable values:" 
  27.      :width 20
  28.      :anchor "center"
  29.      :font "-Adobe-helvetica-medium-r-normal--*-180*")
  30.   (pack (& w ".title") :side "top" :fill "x")
  31.   
  32.   (for-each (lambda(i)
  33.           (let* ((w.i     (& w "." i))
  34.              (w.i.name  (& w.i ".name"))
  35.              (w.i.value (& w.i ".value")))
  36.         (frame w.i)
  37.         (label w.i.name :text (format #f "~A: " i))
  38.         (label w.i.value :textvar i)
  39.         (pack w.i.name w.i.value :side "left")
  40.         (pack w.i :side "top" :anchor "w")))
  41.         args)
  42.  
  43.   (pack [button (& w ".ok") :text " OK " :command (lambda () 
  44.                             (destroy w))]
  45.     :side "bottom" 
  46.     :pady 2))
  47.  
  48.  
  49. (define a 1)
  50. (define b '(1 2 (a b d) x 1))
  51. (define c "A string")
  52. (show-vars '.test 'a 'b 'c)
  53. (format #t "Try to modify value of displayed variables with set!\n")
  54.  
  55.